<template>
    <div id="login">
    <div class="bgc">
      <div class="log">
        <img src="../assets/logo.926d2fa6.png" alt />
        <p>幼稚甄选·高枕无忧</p>
        <form action="" >
          <ul>
            <li>
              <input type="text" placeholder="请输入您的用户名" v-model.trim="form_data.username" />
            </li>
            <li>
              <input type="password" placeholder="请输入相应的密码" v-model.trim="form_data.password" />
            </li>
            <li>
              <button @click="submie">登陆</button>
            </li>
          </ul>
        </form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      form_data:{
        username:'admin',
        password:'admin888'
      }
    }
  },
  methods:{
    submie(){
      this.$http.post('/userlogin',this.form_data).then(
        res=>{
          if(res.code == 200){
            var log_list= JSON.stringify(res.list) 
            localStorage.setItem('log_list',log_list)
            this.$router.push('/index')
          }else{
            alert(res.msg)
          }
          
        }
      )
    }
  }

}
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
#login {
  min-height: 100vh;
  background-color: rgb(255, 90, 59);
}
.bgc {
  float: right;
  width: 800px;
  height: 600px;
  background-image: url("../assets/loginbg.png");
  background-repeat: no-repeat;
  background-size: 100%;
  margin: 30px 100px;
}
.log {
  text-align: center;
  float: right;
  width: 300px;
  margin-right: 80px;
  margin-top: 150px;
}
.log img {
  width: 100%;
  margin-bottom: 20px;
}
.log p {
  letter-spacing: 15px;
  font-size: 18px;
  color: #bcb8b7;
  margin-bottom: 50px;
}
.log li {
  list-style: none;
  line-height: 70px;
}
.log input {
  background-color: transparent;
  outline: none;
  text-indent: 5px;
  width: 100%;
  height: 30px;
  border: none;
  border-bottom: 1px solid rgb(255, 90, 59);
}
.log button {
  width: 100%;
  height: 40px;
  outline: none;
  border: none;
  background-color: rgb(255, 90, 59);
  border-radius: 20px;
  color: #fff;
  letter-spacing: 20px;
}
</style>